package dashboard_controller

import (
	"github.com/gin-gonic/gin"

	app_global "app/app_src/framework/app/global"
	"app/app_src/framework/i18n"
	web_util "app/app_src/framework/util/web"
	dashboard_util "app/app_src/modules/dashboard/util"
)

const _DASHBOARD_MENU_XML_PATH = "resources/app/menu/dashboard-menu.xml"

func Dashboard(ctx *gin.Context) {
	web_util.OkHTML(ctx, "dashboard/dashboard", nil)
}

func DashboardDefault(ctx *gin.Context) {
	web_util.PageHeaders(ctx, "default", i18n.T("默认"))
	web_util.OkHTML(ctx, "dashboard/default", nil)
}

func ListDashboardMenus(ctx *gin.Context) {
	embedFS := app_global.EmbedFS()
	menus := dashboard_util.ParseMenuXML(embedFS, _DASHBOARD_MENU_XML_PATH)

	web_util.OkResult(ctx, menus)
}
